package org.supreme.basic.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.supreme.basic.dtovo.Smscode;
import org.supreme.basic.result.JSONResult;
import org.supreme.basic.service.verifyCodeService;

import javax.validation.Valid;

@RestController
@RequestMapping("/verifyCode")
public class verifyCodeController {
    @Autowired
    private verifyCodeService verifyCodeService;

    @GetMapping("/image/{imageCodeKey}")
    public JSONResult verifyCode(@PathVariable String imageCodeKey){
       return verifyCodeService.verifyCode(imageCodeKey);
    }
    @PostMapping("/sendSmsCode")
    public JSONResult smscode(@RequestBody @Valid Smscode smscode){
        verifyCodeService.smscode(smscode);
        return JSONResult.success();
    }
}
